import { defHttp } from '@/utils/http/axios';

const baseUrl = '/customerManagement';
const devicesUrl = '/devices';
const sourcesUrl = '/sources';
const serviceReminderUrl = '/serviceReminder';
const customerManagementUrl = '/customerManagement';

enum Api {
  login = `${baseUrl}/updateCustomerManagement`,
}
enum Api {
  create = `${baseUrl}/createCustomerManagement`,
  delete = `${baseUrl}/deleteCustomerManagement`,
  getId = `${baseUrl}/getCustomerManagementById`,
  search = `${baseUrl}/searchCustomerManagement`,
  update = `${baseUrl}/updateCustomerManagement`,
  excelImport = `${baseUrl}/excelImport`,
  excelExport = `${baseUrl}/excelExport`,
  // 办结
  completion = `${baseUrl}/completion`,

  // 设备-设备型号相关接口
  searchDevices = `${devicesUrl}/searchDevices`,

  // 线索来源相关接口 : Sources Controller
  searchSources = `${sourcesUrl}/searchSources`,
  createSources = `${sourcesUrl}/createSources`,
  deleteSources = `${sourcesUrl}/deleteSources`,
  updateSources = `${sourcesUrl}/updateSources`,

  // 客户提醒POST /serviceReminder/searchServiceReminder
  updateServiceReminder = `${serviceReminderUrl}/updateServiceReminder`,
  searchServiceReminder = `${serviceReminderUrl}/searchServiceReminder`,
  deleteServiceReminder = `${serviceReminderUrl}/deleteServiceReminder`,
  createServiceReminder = `${serviceReminderUrl}/createServiceReminder`,
  completionReminder = `${serviceReminderUrl}/completion`,

  // 退货
  returnGoods = `${customerManagementUrl}/returnGoods`,
}

//
export const getManagementCreate = (params?: Recordable) =>
  defHttp.post({ url: Api.create, params });
export const getManagementDelete = (params?: Recordable) =>
  defHttp.post({ url: Api.delete, params });
export const getManagementGetId = (params?: Recordable) => defHttp.post({ url: Api.getId, params });
export const getManagementSearch = (params?: Recordable) =>
  defHttp.post({ url: Api.search, params });
export const getManagementUpdate = (params?: Recordable) =>
  defHttp.post({ url: Api.update, params });
export const getManagementExcelImport = (params) => defHttp.uploadFile({ url: Api.excelImport }, params);
export const getManagementExcelExport = () => defHttp.uploadFile({ url: Api.excelExport });
// 办结
export const handleCompletion = (params?: Recordable) =>
  defHttp.post({ url: Api.completion, params });

// 设备-设备型号相关接口
export const getSearchDevices = (params?: Recordable) =>
  defHttp.post({ url: Api.searchDevices, params });

// 线索来源相关接口
export const getSearchSources = (params?: Recordable) =>
  defHttp.post({ url: Api.searchSources, params });
export const getCreateSources = (params?: Recordable) =>
  defHttp.post({ url: Api.createSources, params });
export const getDeleteSources = (params?: Recordable) =>
  defHttp.post({ url: Api.deleteSources, params });
export const getUpdateSources = (params?: Recordable) =>
  defHttp.post({ url: Api.updateSources, params });

// 客户提醒
export const getSearchServiceReminder = (params?: Recordable) =>
  defHttp.post({ url: Api.searchServiceReminder, params });
export const getUpdateServiceReminder = (params?: Recordable) =>
  defHttp.post({ url: Api.updateServiceReminder, params });
export const getDeleteServiceReminder = (params?: Recordable) =>
  defHttp.post({ url: Api.deleteServiceReminder, params });
export const getCreateServiceReminder = (params?: Recordable) =>
  defHttp.post({ url: Api.createServiceReminder, params });
export const completionReminder = (params?: Recordable) =>
  defHttp.post({ url: Api.completionReminder, params });

// 退货
export const returnGoods = (params?: Recordable) => defHttp.post({ url: Api.returnGoods, params });
